<template>
  <div class="boxes">
    <div class="box">
      <div class="title">项目概况</div>
      <div class="coutents">
        <div class="only">
          <img src="@/assets/home/icon@2x.png">
          <div>
            <p class="span1">政府投资项目数</p>
            <span class="span2">{{ statistics1.onlineGmProNum }}</span>
            <span class="span3">个</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon2@2x.png">
          <div>
            <p class="span1">企业投资项目数</p>
            <span class="span2">{{ statistics1.onlineQyProNum }}</span>
            <span class="span3">个</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon3@2x.png">
          <div>
            <p class="span1">政府投资额</p>
            <span class="span2">{{ statistics1.onlineGmProMoney.toFixed(0) }}</span>
            <span class="span3">万元</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon4@2x.png">
          <div>
            <p class="span1">企业投资额</p>
            <span class="span2">{{ statistics1.onlineQyProMoney.toFixed(0) }}</span>
            <span class="span3">万元</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title">重点项目</div>
      <div class="coutents">
        <div class="only">
          <img src="@/assets/home/icon5@2x.png">
          <div>
            <p class="span1">政府投资项目数</p>
            <span class="span2">{{ statistics1.localGmProNum }}</span>
            <span class="span3" />
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon6@2x.png">
          <div>
            <p class="span1">企业投资项目数</p>
            <span class="span2">{{ statistics1.localQyProNum }}</span>
            <span class="span3" />
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon7@2x.png">
          <div>
            <p class="span1">政府投资额</p>
            <span class="span2">{{ statistics1.localGmProMoney }}</span>
            <span class="span3">万元</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon8@2x.png">
          <div>
            <p class="span1">企业投资额</p>
            <span class="span2">{{ statistics1.localQyProMoney }}</span>
            <span class="span3">万元</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title">企业投资额</div>
      <div class="coutents">
        <div id="ech1" ref="ech1" style="width: 50%;" />
        <div style="width: 50%;margin-top: 15px;">
          <div class="cirlist" v-for="(item,index) in statistics2.slice(0, 6)" :key="index">
            <span class="circle" :class="['circolor'+(index+1)]" />
            <span class="span1 spantext" style="margin-bottom: 0;" :title="item.name">{{ item.name }}</span>
            <span
              class="span4"
              :class="['color'+(index+1)]"
              style="margin-bottom: 0;float: right;margin-right: 15px;"
            >{{ (item.scale * 100) .toFixed(0)}}%</span>
            <span class="span1" style="margin-bottom: 0;float: right;margin-right: 35px;">
              {{ item.num }}个
            </span>

          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title">各镇街道项目分布</div>
      <div id="ech2" ref="ech2" class="coutents" style="width: 100%" />
    </div>
    <div class="box">
      <div class="title">审批效率分析</div>
      <div class="coutents">
        <div class="only">
          <img src="@/assets/home/icon9@2x.png">
          <div>
            <p class="span1">年度办件量</p>
            <span class="span2">{{ statistics3.yearOfficeNum }}</span>
            <span class="span3">件</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon10@2x.png">
          <div>
            <p class="span1">月度办件量</p>
            <span class="span2">{{ statistics3.monthOfficeNum }}</span>
            <span class="span3">件</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon11@2x.png">
          <div>
            <p class="span1">事项平均审批时长</p>
            <span class="span2">{{ statistics3.itemAvgHour }}</span>
            <span class="span3">小时</span>
          </div>
        </div>
        <div class="only">
          <img src="@/assets/home/icon12@2x.png">
          <div>
            <p class="span1">项目全链条时长</p>
            <span class="span2">{{ statistics3.allHour }}</span>
            <span class="span3">天</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title">代办服务分析</div>
      <div class="coutents">
        <div class="wid1">
          <span class="span4">代办员</span>
          <span class="span6">人</span>
          <span class="span5">{{ statistics4.agentPeopleNum }}</span>
        </div>
        <div class="wid1">
          <span class="span4">代办项目数</span>
          <span class="span6">个</span>
          <span class="span5">{{ statistics4.agentProjectNum }}</span>
        </div>
        <div class="wid1">
          <span class="span4">服务次数</span>
          <span class="span6">次</span>
          <span class="span5">{{ statistics4.serviceNum }}</span>
        </div>
        <div class="wid1">
          <span class="span4">服务效率</span>
          <span class="span6">%</span>
          <span class="span5">{{ statistics4.serviceRate * 100 }}</span>
        </div>
        <div class="wid1">
          <span class="span4">总体评价</span>
          <span class="span6">分</span>
          <span class="span5">{{ statistics4.score }}</span>
        </div>
        <div class="wid1">
          <span class="span4">解决效率</span>
          <span class="span6">%</span>
          <span class="span5">{{ statistics4.solutionRate }}</span>
        </div>
        <div class="wid2" style="margin-top: 24px;">
          <span class="span4" style="margin-right: 16px;">解决效率</span>
          <processBar
            :processValue="processValue1"
            style="width: 311px;border-radius: 6px;"
          />
          <span class="span4" style="margin-left: 16px;">{{ statistics4.sumProblem }}</span>
        </div>
        <div class="wid2" style="margin-bottom: 33px;margin-top: 29px;">
          <div>
            <div class="round rcolor5" />
            <span class="span7">已解决</span>
            <span class="span7 color5 ml">{{ statistics4.solveProblem }}件</span>
          </div>
          <div>
            <div class="round rcolor6" />
            <span class="span7">延期</span>
            <span class="span7 color6 ml">{{ statistics4.delayProblem }}件</span>
          </div>
          <div>
            <div class="round rcolor7" />
            <span class="span7">未解决</span>
            <span class="span7 color7 ml">{{ statistics4.unsolvedProblem }}件</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box" style="width: 100%;background-color: none;height: auto;">
      <div class="title">段长制管理</div>
      <div
        class="coutents"
        style="background: none;justify-content: space-between;box-shadow:none;height: auto;"
      >
        <div class="smallbox" v-for="(item, index) in statistics6" :key="index">
          <div class="smalltitle">{{item.stageName}}</div>
          <div class="sumtitle">
            <span class="span8">处理项目数量</span>
            <span class="span9">{{item.projectSum}}</span>
          </div>
          <processBar
            :processValue="[
              {
          name: '已办',
          color: '#37B3FA',
          data: item.projectDone
        },{
          name: '正在办',
          color: '#FFAB2B',
          data: item.projectHave
        },
            ]"
            :height="3"
            style="width: 220px;border-radius: 6px;"
          />
          <div class="separate">
            <div class="squ">
              <div class="round2 rcolor5" />
              <span class="span10">已办</span>
              <span class="span11 color5">{{ item.projectDone }}</span>
              <span class="span10">件</span>
            </div>
            <div class="squ">
              <div class="round2 rcolor7" />
              <span class="span10">正在办</span>
              <span class="span11 color7">{{item.projectHave}}</span>
              <span class="span10">件</span>
            </div>
          </div>
          <div class="sumtitle">
            <span class="span8">解决问题数量</span>
            <span class="span9">{{item.problemSum}}</span>
          </div>
          <processBar
            :processValue="[
              {
          name: '已办',
          color: '#37B3FA',
          data: item.problemDone
        },{
          name: '正在办',
          color: '#FFAB2B',
          data: item.problemHave
        },
            ]"
            :height="3"
            style="width: 220px;border-radius: 6px;"
          />
          <div class="separate">
            <div class="squ">
              <div class="round2 rcolor5" />
              <span class="span10">已解决</span>
              <span class="span11 color5">{{item.problemDone}}</span>
              <span class="span10">件</span>
            </div>
            <div class="squ">
              <div class="round2 rcolor7" />
              <span class="span10">未解决</span>
              <span class="span11 color7">{{ item.problemHave }}</span>
              <span class="span10">件</span>
            </div>
          </div>
          <div class="orbox">
            <img src="@/assets/home/clock.png">
            <div>
              <div class="ortitle">平均审批效率</div>
              <span class="span12">{{ item.approvalRate }}</span>
              <span class="span13">天</span>
            </div>
          </div>
        </div>

      </div>
    </div>
    <div class="box">
      <div class="title" style="margin-top: 15px;">掌上中介分析</div>
      <div
        class="coutents"
        style="background: none;justify-content: space-between;box-shadow:none"
      >
        <div class="only2">
          <div class="only2t">中介机构总数</div>
          <div>
            <img src="@/assets/home/jgzs@2x.png">
            <span class="span2">{{ statistics5.zjSum }}</span>
          </div>
        </div>
        <div class="only2">
          <div class="only2t">中介事项总数</div>
          <div>
            <img src="@/assets/home/zssx@2x.png">
            <span class="span2">{{ statistics5.zjItemSum }}</span>
          </div>
        </div>
        <div class="only2">
          <div class="only2t">总服务项目数</div>
          <div>
            <img src="@/assets/home/zfw@2x.png">
            <span class="span2">{{ statistics5.serviceSum }}</span>
          </div>
        </div>
        <div class="only2">
          <div class="only2t">中介好评率</div>
          <div>
            <img src="@/assets/home/zjhp@2x.png">
            <span class="span2">{{ statistics5.goodRate * 100 }}%</span>
          </div>
        </div>
        <div class="only2">
          <div class="only2t">中选事项数</div>
          <div>
            <img src="@/assets/home/zxsx@2x.png">
            <span class="span2">{{ statistics5.checkSum }}</span>
          </div>
        </div>
        <div class="only2">
          <div class="only2t">比选成交率</div>
          <div>
            <img src="@/assets/home/cjl@2x.png">
            <span class="span2">{{ statistics5.orderRate * 100 }}%</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title" style="margin-top: 15px;" />
      <div
        class="coutents"
        style="background: none;justify-content: space-between;box-shadow:none"
      >
        <div class="only3">
          <ul>
            <li v-for="(item,index) in listred.slice(0, 3)" :key="index">
              <img src="@/assets/home/redrank.png">
              <div>
                <span class="red">(红榜)</span><span class="black">{{ item.corporateName }}</span>
              </div>
            </li>
          </ul>
        </div>
        <div class="only3">
          <ul>
            <li v-for="(item,index) in listblack.slice(0, 3)" :key="index">
              <img src="@/assets/home/blackbank.png">
              <div>
                <span>(黑榜)</span><span>{{ item.corporateName }}</span>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { http_home } from "@/api";
import * as echarts from 'echarts'
import processBar from './processBar.vue'
export default {
  components: { processBar },
  data() {
    return {
      processValue1: [
        {
          name: '乙烯',
          color: '#37B3FA',
          data: 1
        },
        {
          name: '丁二烯',
          color: '#EE4040',
          data: 1
        },
        {
          name: '化工苯',
          color: '#FFAB2B',
          data: 1
        }
      ],
      statistics1: [],
      statistics2: [],
      statistics3: [],
      statistics4: [],
      statistics5: [],
      listred: [],
      listblack: [],
      statistics6: []
    }
  },
  created() {
    http_home.countInvestProject().then(res => {
      this.statistics1 = res.data
    })
    http_home.countApproval().then(res => {
      this.statistics3 = res.data
    })
    http_home.countService().then(res => {
      this.statistics4 = res.data
      this.processValue1[0].data = res.data.solveProblem
      this.processValue1[1].data = res.data.delayProblem
      this.processValue1[2].data = res.data.unsolvedProblem
    })
    http_home.countIntermediary().then(res => {
      this.statistics5 = res.data
    })
    http_home.PageList({ pageNo: 1, pageSize: 3, type: 1 }).then(res => {
      this.listred = res.data.records
    })
    http_home.PageList({ pageNo: 1, pageSize: 3, type: 2 }).then(res => {
      this.listblack = res.data.records
    })
    http_home.countProjectType().then(res => {
      this.getechart1(res.data.slice(0, 6))
      this.statistics2 = res.data
    })
    http_home.countDistrictProList().then(res => {
      this.getechart2(res.data)
    })
    http_home.mangerList().then(res => {
      this.statistics6 = res.data
    })
  },
  methods: {
    // http_project_process_template.getCategory({ top: 0 }).then(res => {
    //   this.options1 = res.data
    // })
    // getstatistics1() {

    // },
    getechart1(data) {
      data.forEach(element => {
        element.value = element.num
      })
      var option
      option = {
        legend: {
          top: 'bottom',
          show: false
        },
        toolbox: {
          show: false,
          feature: {
            mark: { show: true },
            dataView: { show: true, readOnly: false },
            restore: { show: true },
            saveAsImage: { show: true }
          }
        },
        color: ['#FFAB2B', '#AAC3FF', '#58C5F6', '#38B4FB', '#0C89D1', '#3872FB'],
        series: [
          {
            type: 'pie',
            label: {
              normal: {
                show: false
              }
            },
            roseType: 'area',
            data: data
          }
        ]
      }
      var chartDom = document.getElementById('ech1')
      var myChart = echarts.init(chartDom)
      option && myChart.setOption(option)
    },
    getechart2(data) {
      var chartDom = document.getElementById('ech2')
      var myChart = echarts.init(chartDom)
      var option
      var xAxisdata = []
      var proSumdata = []
      var sumMoneydata = []
      data.forEach(element => {
        xAxisdata.push(element.district)
        proSumdata.push(element.proSum)
        sumMoneydata.push(element.sumMoney)
      });
      option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            crossStyle: {
              color: '#999'
            }
          }
        },
        toolbox: {
          feature: {}
        },
        color: ['#37B3FA', '#FFAB2B'],
        legend: {
          data: ['项目总数', '总投资额'],
          icon: 'circle'
        },
        xAxis: [
          {
            type: 'category',
            data: xAxisdata,
            axisPointer: {},
            axisLabel: {
              interval: 0
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '（个）',
            min: 0,
            // max: 250,
            // interval: 50,
            axisLabel: {}
          },
          {
            type: 'value',
            name: '（万元）',
            // min: 0,
            // max: 25,
            // interval: 5,
            axisLabel: {}
          }
        ],
        series: [
          {
            name: '项目总数',
            type: 'bar',
            barWidth: 10,
            data: proSumdata
          },

          {
            name: '总投资额',
            type: 'bar',
            yAxisIndex: 1,
            barWidth: 10,
            data: sumMoneydata
          }
        ]
      }

      option && myChart.setOption(option)
    }
  },
  mounted() {

  }
}
</script>
<style lang="scss" scoped>
.ml {
  margin-left: 20px;
}
.rcolor5 {
  background: #37b3fa;
}
.rcolor6 {
  background: #ee4040;
}
.rcolor7 {
  background: #ffab2b;
}
.color5 {
  color: #37b3fa !important;
}
.color6 {
  color: #ee4040 !important;
}
.color7 {
  color: #ffab2b !important;
}
.span2 {
  font-size: 30px;
  font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  font-weight: bold;
  color: #fca829;
}
.boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .box {
    // flex: 1;
    height: 330px;
    width: calc(50% - 15px);
    min-width: 545px;
    .title {
      font-size: 22px;
      font-family: Source Han Sans CN-Medium, Source Han Sans CN;
      font-weight: 500;
      color: #202224;
      line-height: 70px;
      height: 70px;
    }
    .coutents {
      height: 260px;
      width: 100%;
      background: #ffffff;
      box-shadow: 6px 6px 54px 1px rgba(0, 0, 0, 0.05);
      border-radius: 14px;
      opacity: 1;
      display: flex;
      flex-wrap: wrap;
      .only {
        width: 50%;
        height: 76px;
        padding: 37px 0 0 29px;
        display: flex;
        img {
          height: 75.75px;
          width: 89.68px;
        }
        .span1 {
          font-size: 16px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #333333;
          margin-bottom: 30px;
        }

        .span3 {
          font-size: 13px;
          font-family: Source Han Sans CN-Bold, Source Han Sans CN;
          font-weight: bold;
          color: #fca829;
        }
      }
      .cirlist {
        height: auto;
        margin-bottom: 20px;
        .spantext{
          overflow:hidden;
          word-spacing:nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
          width: 110px;
          display: inline-block;
        }
        .circle {
          display: inline-flex;
          width: 12px;
          height: 12px;
          background: #ffffff;
          opacity: 1;
          border-radius: 6px;
          margin-right: 20px;
        }
        .circolor1 {
          border: 4px solid #4880ff;
        }
        .circolor2 {
          border: 4px solid #66c2f5;
        }
        .circolor3 {
          border: 4px solid #fec400;
        }
        .circolor4 {
          border: 4px solid #afc8ff;
        }
        .circolor5 {
          border: 4px solid #0C89D1;
        }
        .circolor6 {
          border: 4px solid #3872FB;
        }
        .color1 {
          color: #4880ff;
        }
        .color2 {
          color: #66c2f5;
        }
        .color3 {
          color: #fec400;
        }
        .color4 {
          color: #afc8ff;
        }
        .color5 {
          color: #0C89D1;
        }
        .color6 {
          color: #3872FB;
        }
      }
      .wid1 {
        width: calc(50% - 63px);
        margin-left: 54px;
        margin-top: 31px;
        .span4 {
          font-size: 14px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #333333;
          line-height: 21px;
        }
        .span5 {
          color: #37b3fa;
          float: right;
          font-size: 32px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          line-height: 10px;
        }
        .span6 {
          color: #333333;
          float: right;
          font-size: 16px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
        }
      }
      .wid2 {
        width: calc(100% - 101px);
        display: flex;
        margin-left: 61px;
        justify-content: space-between;
        div {
          display: flex;

          .round {
            width: 10px;
            height: 10px;
            margin-right: 11px;
            border-radius: 5px;
          }
          .span7 {
            font-size: 14px;
            font-family: Rubik-Regular, Rubik;
            font-weight: 400;
            color: #252631;
          }
        }
      }
      .smallbox {
        width: 279px;
        height: 278px;
        background: #ffffff;
        box-shadow: 6px 6px 54px 1px rgba(0, 0, 0, 0.05);
        border-radius: 14px 14px 14px 14px;
        opacity: 1;
        padding: 0 30px;
        .smalltitle {
          font-size: 14px;
          font-family: Source Han Sans CN-Bold, Source Han Sans CN;
          font-weight: bold;
          color: #333333;
          margin-top: 16px;
          text-align: center;
        }
        .sumtitle {
          display: flex;
          justify-content: space-between;
          margin-top: 15px;
          margin-bottom: 11px;
          .span8 {
            font-size: 10px;
            font-family: Source Han Sans CN-Medium, Source Han Sans CN;
            font-weight: 500;
            color: #31394d;
          }
          .span9 {
            font-size: 8px;
            font-family: Roboto-Bold, Roboto;
            font-weight: bold;
            color: #31394d;
          }
        }
        .separate {
          width: calc(100% - 54px);
          margin-left: 27px;
          display: flex;
          justify-content: space-between;
          margin-top: 10px;
          line-height: 6px;
          .squ {
            display: flex;
            span {
              margin-right: 3px;
            }
            .round2 {
              width: 7px;
              height: 7px;
              // background: #37B3FA;
              border-radius: 4px;
              margin-right: 10px;
            }
            .span10 {
              font-size: 8px;
              font-family: Roboto-Bold, Roboto;
              color: #31394d;
            }
            .span11 {
              font-size: 12px;
              font-family: Roboto-Bold, Roboto;
              font-weight: bold;
              // color: #37B3FA;
            }
          }
        }
        .orbox {
          display: flex;
          // width: 191px;
          height: 54px;
          background: #fff6e9;
          box-shadow: 0px 32px 60px 1px rgba(119, 140, 162, 0.04);
          border-radius: 10px 10px 10px 10px;
          margin-top: 36px;
          img {
            height: 37px;
            width: 37px;
            margin: 8px 10px 8px 13px;
          }
          .ortitle {
            margin-top: 10px;
            font-size: 12px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 400;
            color: #202224;
          }
          .span12 {
            font-size: 26px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 500;
            color: #ffab2b;
          }
          .span13 {
            font-size: 12px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 300;
            color: #ffab2b;
          }
        }
      }
      .only2 {
        width: calc(33% - 9px);
        height: 99px;
        background: #ffffff;
        .only2t {
          font-size: 16px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #333333;
          margin: 14px 0 7px 24px;
          text-align: center;
        }
        div {
          display: flex;
          margin-left: 18px;
          img {
            height: 46.29px;
            width: 53.29px;
          }
          span {
            margin-top: 16px;
          }
        }
      }
      .only3 {
        width: calc(50% - 10px);
        height: 226px;
        background: #ffffff;
        border-radius: 14px 14px 14px 14px;
        ul {
          padding: 10px 22px;
          margin: 0;
          li {
            height: 65px;
            border-bottom: 1px solid #dcdcdc;
            display: flex;
            img {
              height: 30px;
              width: 30px;
              margin: 14px 13px 21px 0;
            }
            div {
              margin: 14px 17px 18px 0;
            }
            span {
              font-size: 16px;
              font-family: Source Han Sans CN-Regular, Source Han Sans CN;
              font-weight: 400;
              line-height: 18px;
              color: #31394d;
            }
            .red {
                color: #ff0404;
              }
          }
        }
      }
    }
  }
}
p{
  margin-top: 0px;
}
</style>
